// 引入Sequelize模块
const Sequelize = require('sequelize');
const user = require('./user');
const artPPT = require('./artPPT');

// 引入数据库实例
const db = require('../db');
// 定义model

/***微信群管理 */
const wxGroup = db.define('wxGroup', {
    objectId: {
        type: Sequelize.STRING(20),
        allowNull: false,
        unique: true,
        primaryKey: true
    },

    image: {
        type: Sequelize.STRING(200),
    },

    createdAt: {
        type: Sequelize.DATE,
        get() {
            const rawValue = this.getDataValue('createdAt');
            return dateFormat(rawValue, 'yyyy-mm-dd');
        }
    },

    updatedAt: {
        type: Sequelize.DATE,
        get() {
            const rawValue = this.getDataValue('createdAt');
            return dateFormat(rawValue, 'yyyy-mm-dd');
        }
    },
}, {
    // 是否支持驼峰
    underscored: false,
    // MySQL数据库表名
    tableName: 'wxGroup',
});


/*(async () => {
    await wxGroup.sync({
        alter: true,
    });
    console.log("wxGroup字段同步成功！");
})();*/

/**end */


module.exports = {
    wxGroup
};
